<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script src="http://cdn.staticfile.org/moment.js/2.24.0/moment.js"></script>
    <script>
      //  将当前时间转换成某个格式   2014/12/25 13:12:12
      // window.console.log(moment().format('YYYY/MM/DD HH:mm:ss'))
      // 将某个时间转换成相应格式
      let _time = 2051065050512
      let _time2 = 2051005050512
      window.console.log(moment(_time).format('YYYY/MM/DD HH:mm:ss'))
      window.console.log(moment(_time2).format('YYYY/MM/DD HH:mm:ss'))
      // diff   moment时间a.diff(moment时间b,"h/m")
      let _a = moment(_time)
      let _b = moment()
      let _diff = _a.diff(_b, 'h')
      window.console.log(_diff)
    </script>
  </body>
</html>
